﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace RegOnline.Views
{
    public partial class MessageWindow : ChildWindow
    {

        public MessageWindow(string message, string title = "", MessageWindowStyle style = MessageWindowStyle.OK)
        {
            InitializeComponent();

            Message.Text = message;
            title = TitleString;
            WindowStyle = style;
        }


        public string MessageString
        {
            get
            {
                return Message.Text;
            }
            set
            {
                Message.Text = value;
            }
        }

        public string TitleString
        {
            get
            {
                return this.Title as String;
            }
            set
            {
                this.Title  = value;
            }
        }


        public enum MessageWindowStyle
        {
            OK, OKCancel
        }

        private MessageWindowStyle _w=MessageWindowStyle.OK;

        public MessageWindowStyle WindowStyle
        {
            get { return _w; }
            set
            {
                _w = value;
                if (_w == MessageWindowStyle.OK)
                {
                    CancelButton.Visibility = Visibility.Collapsed;

                }
                else
                {
                    CancelButton.Visibility = Visibility.Visible;

                }
            }
        }

        public MessageWindow()
        {
            InitializeComponent();
            WindowStyle = MessageWindowStyle.OK;
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

